﻿Imports System.ComponentModel
Imports DevExpress.XtraBars
Imports DevExpress.XtraBars.Ribbon
Imports DevExpress.XtraBars.Helpers
Imports DevExpress.Skins
Imports DevExpress.LookAndFeel
Imports DevExpress.UserSkins
Imports System.IO

Public Class Main
    Public TenDoanhNghiep As String
    Public DiaChiDoanhNghiep As String
    Sub New()
        'InitSkins()
        InitializeComponent()
        TenDoanhNghiep = ThongTinTableAdapter1.GetData().Rows(0).Item(1)
        DiaChiDoanhNghiep = Me.ThongTinTableAdapter1.GetData().Rows(0).Item(2)
    End Sub
    Sub InitSkins()
        DevExpress.Skins.SkinManager.EnableFormSkins()
        DevExpress.UserSkins.BonusSkins.Register()
        UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue")
    End Sub
    Private Sub InitSkinGallery()
        SkinHelper.InitSkinGallery(rgbiSkins, True)
    End Sub

    Private Sub Main_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        Application.ExitThread()
    End Sub

    Private Sub Main_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        InitSkins()
        Me.InitSkinGallery()
        'xử lý lấy hình từ database
        Dim byteBLOBData As [Byte]() = New [Byte]() {}
        byteBLOBData = DirectCast(Me.ThongTinTableAdapter1.GetData.Rows(0).Item("logo"), [Byte]())
        Dim stmBLOBData As New MemoryStream(byteBLOBData)
        'gán lại vô xrpicture để hiện hình ảnh
        Dim img As Image = Image.FromStream(stmBLOBData)
        Dim bm As Bitmap = img
        Dim hIcon As IntPtr = bm.GetHicon
        Dim TheIcon As Icon = Icon.FromHandle(hIcon)
        Me.Icon = TheIcon
        Login.Close()
    End Sub

    Private Sub BarbuttonItemBacSi_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarbuttonItemBacSi.ItemClick
        Me.ribbonControl.Minimized = True
        DMBacSi.Show()
        DMBacSi.MdiParent = Me
        DMBacSi.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemToaThuocMau_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemToaThuocMau.ItemClick
        Me.ribbonControl.Minimized = True
        ToaThuocMau.Show()
        ToaThuocMau.MdiParent = Me
        ToaThuocMau.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemDMhangHoa_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemDMhangHoa.ItemClick
        Me.ribbonControl.Minimized = True
        DMHangHoa.Show()
        DMHangHoa.MdiParent = Me
        DMHangHoa.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemTaiKhoan_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemTaiKhoan.ItemClick
        Me.ribbonControl.Minimized = True
        TaiKhoanHeThong.Show()
        TaiKhoanHeThong.MdiParent = Me
        TaiKhoanHeThong.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemNhomTaiKhoan_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemNhomTaiKhoan.ItemClick
        Me.ribbonControl.Minimized = True
        NhomTaiKhoanHeThong.Show()
        NhomTaiKhoanHeThong.MdiParent = Me
        NhomTaiKhoanHeThong.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemDoSinhHieu_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemDoSinhHieu.ItemClick
        Me.ribbonControl.Minimized = True
        DoSinhHieu.Show()
        DoSinhHieu.MdiParent = Me
        DoSinhHieu.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemDangXuat_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemDangXuat.ItemClick
        Me.Hide()
        Login.Show()
    End Sub

    Private Sub BarButtonItemNhapHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemNhapHang.ItemClick
        Me.ribbonControl.Minimized = True
        NhapHang.Show()
        NhapHang.MdiParent = Me
        NhapHang.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemBenh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemBenh.ItemClick
        Me.ribbonControl.Minimized = True
        DMBenh.Show()
        DMBenh.MdiParent = Me
        DMBenh.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemDonViTinh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemDonViTinh.ItemClick
        Me.ribbonControl.Minimized = True
        DMDonViTinh.Show()
        DMDonViTinh.MdiParent = Me
        DMDonViTinh.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemIcd_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemIcd.ItemClick
        Me.ribbonControl.Minimized = True
        DMIcd.Show()
        DMIcd.MdiParent = Me
        DMIcd.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemKhachHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemKhachHang.ItemClick
        Me.ribbonControl.Minimized = True
        DMKhachHang.Show()
        DMKhachHang.MdiParent = Me
        DMKhachHang.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemKhamBenh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemKhamBenh.ItemClick
        Me.ribbonControl.Minimized = True
        DMKhamBenh.Show()
        DMKhamBenh.MdiParent = Me
        DMKhamBenh.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemKhoa_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemKhoa.ItemClick
        Me.ribbonControl.Minimized = True
        DMKhoa.Show()
        DMKhoa.MdiParent = Me
        DMKhoa.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemNganHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemNganHang.ItemClick
        Me.ribbonControl.Minimized = True
        DMNganHang.Show()
        DMNganHang.MdiParent = Me
        DMNganHang.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemNganhNghe_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemNganhNghe.ItemClick
        Me.ribbonControl.Minimized = True
        DMNganhNghe.Show()
        DMNganhNghe.MdiParent = Me
        DMNganhNghe.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemNhanVien_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemNhanVien.ItemClick
        Me.ribbonControl.Minimized = True
        DMNhanVien.Show()
        DMNhanVien.MdiParent = Me
        DMNhanVien.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemPhong_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemPhong.ItemClick
        Me.ribbonControl.Minimized = True
        DMPhong.Show()
        DMPhong.MdiParent = Me
        DMPhong.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemPhongBan_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemPhongBan.ItemClick
        Me.ribbonControl.Minimized = True
        DMPhongBan.Show()
        DMPhongBan.MdiParent = Me
        DMPhongBan.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemPhongKhamBenhVien_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemPhongKhamBenhVien.ItemClick
        Me.ribbonControl.Minimized = True
        DMPhongKhamBenhVien.Show()
        DMPhongKhamBenhVien.MdiParent = Me
        DMPhongKhamBenhVien.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemQuocGia_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemQuocGia.ItemClick
        Me.ribbonControl.Minimized = True
        DMQuocGia.Show()
        DMQuocGia.MdiParent = Me
        DMQuocGia.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemTinhThanh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemTinhThanh.ItemClick
        Me.ribbonControl.Minimized = True
        DMTinhThanh.Show()
        DMTinhThanh.MdiParent = Me
        DMTinhThanh.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemQuanHuyen_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemQuanHuyen.ItemClick
        Me.ribbonControl.Minimized = True
        DMQuanHuyen.Show()
        DMQuanHuyen.MdiParent = Me
        DMQuanHuyen.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemPhuongXa_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemPhuongXa.ItemClick
        Me.ribbonControl.Minimized = True
        DMPhuongXa.Show()
        DMPhuongXa.MdiParent = Me
        DMPhuongXa.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemXuatHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemXuatHang.ItemClick
        Me.ribbonControl.Minimized = True
        XuatHang.Show()
        XuatHang.MdiParent = Me
        XuatHang.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemTonKho_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemTonKho.ItemClick
        Me.ribbonControl.Minimized = True
        TonKho1.Show()
        TonKho1.MdiParent = Me
        TonKho1.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemTheKho_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemTheKho.ItemClick
        Me.ribbonControl.Minimized = True
        TheKho1.Show()
        TheKho1.MdiParent = Me
        TheKho1.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemTiepNhanBenhNhan_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemTiepNhanBenhNhan.ItemClick
        Me.ribbonControl.Minimized = True
        TiepNhanBenhNhan_DOI.Show()
        TiepNhanBenhNhan_DOI.MdiParent = Me
        TiepNhanBenhNhan_DOI.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemBenhNhan_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemBenhNhan.ItemClick
        Me.ribbonControl.Minimized = True
        DMBenhNhan.Show()
        DMBenhNhan.MdiParent = Me
        DMBenhNhan.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemCachDung_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemCachDung.ItemClick
        Me.ribbonControl.Minimized = True
        DMCachDung.Show()
        DMCachDung.MdiParent = Me
        DMCachDung.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemChiNhanh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemChiNhanh.ItemClick
        Me.ribbonControl.Minimized = True
        DMChiNhanh.Show()
        DMChiNhanh.MdiParent = Me
        DMChiNhanh.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemDanDo_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemDanDo.ItemClick
        Me.ribbonControl.Minimized = True
        DMDanDo.Show()
        DMDanDo.MdiParent = Me
        DMDanDo.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemCanhBaoSoLuong_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemCanhBaoSoLuong.ItemClick
        Me.ribbonControl.Minimized = True
        CanhBao_SoLuong.Show()
        CanhBao_SoLuong.MdiParent = Me
        CanhBao_SoLuong.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemCanhBaoHanDung_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemCanhBaoHanDung.ItemClick
        Me.ribbonControl.Minimized = True
        CanhBao_HanDung.Show()
        CanhBao_HanDung.MdiParent = Me
        CanhBao_HanDung.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemThuChiTienMat_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemThuChiTienMat.ItemClick
        Me.ribbonControl.Minimized = True
        ThuChiTienMat.Show()
        ThuChiTienMat.MdiParent = Me
        ThuChiTienMat.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemThuChiNganHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemThuChiNganHang.ItemClick
        Me.ribbonControl.Minimized = True
        ThuChiNganHang1.Show()
        ThuChiNganHang1.MdiParent = Me
        ThuChiNganHang1.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemXuatHoaDon_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemXuatHoaDon.ItemClick
        Me.ribbonControl.Minimized = True
        XuatHoaDon.Show()
        XuatHoaDon.MdiParent = Me
        XuatHoaDon.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemPhieuKhamBenh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemPhieuKhamBenh.ItemClick
        Me.ribbonControl.Minimized = True
        PhieuKhamBenh.Show()
        PhieuKhamBenh.MdiParent = Me
        PhieuKhamBenh.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemNghiepVu_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemNghiepVu.ItemClick
        Me.ribbonControl.Minimized = True
        DMNghiepVu.Show()
        DMNghiepVu.MdiParent = Me
        DMNghiepVu.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemBangGia_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemBangGia.ItemClick
        Me.ribbonControl.Minimized = True
        BangGia.Show()
        BangGia.MdiParent = Me
        BangGia.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemPhanHe_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemPhanHe.ItemClick
        Me.ribbonControl.Minimized = True
        DMPhanHe.Show()
        DMPhanHe.MdiParent = Me
        DMPhanHe.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemManHinh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemManHinh.ItemClick
        Me.ribbonControl.Minimized = True
        DMManHinh.Show()
        DMManHinh.MdiParent = Me
        DMManHinh.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemSoNhatKyMuaHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemSoNhatKyMuaHang.ItemClick
        Me.ribbonControl.Minimized = True
        SoNhatKyMuaHang.Show()
        SoNhatKyMuaHang.MdiParent = Me
        SoNhatKyMuaHang.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemSoNhatKyBanHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemSoNhatKyBanHang.ItemClick
        Me.ribbonControl.Minimized = True
        SoNhatKyBanHang.Show()
        SoNhatKyBanHang.MdiParent = Me
        SoNhatKyBanHang.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemCongNoPhaiThu_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemCongNoPhaiThu.ItemClick
        Me.ribbonControl.Minimized = True
        CongNoPhaiThu.Show()
        CongNoPhaiThu.MdiParent = Me
        CongNoPhaiThu.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemCongNoPhaiTra_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemCongNoPhaiTra.ItemClick
        Me.ribbonControl.Minimized = True
        CongNoPhaiTra.Show()
        CongNoPhaiTra.MdiParent = Me
        CongNoPhaiTra.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemTonQuy_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemTonQuy.ItemClick
        Me.ribbonControl.Minimized = True
        TonQuy.Show()
        TonQuy.MdiParent = Me
        TonQuy.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemCabDoiTaiKhoan_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemCanDoiTaiKhoan.ItemClick
        Me.ribbonControl.Minimized = True
        CanDoiTaiKhoan.Show()
        CanDoiTaiKhoan.MdiParent = Me
        CanDoiTaiKhoan.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemHopDongMuaBan_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemHopDongMuaBan.ItemClick
        Me.ribbonControl.Minimized = True
        HopDongMuaBan.Show()
        HopDongMuaBan.MdiParent = Me
        HopDongMuaBan.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemDonDatHang_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemDonDatHang.ItemClick
        Me.ribbonControl.Minimized = True
        DonDatHang.Show()
        DonDatHang.MdiParent = Me
        DonDatHang.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemChuongTrinhKhuyenMai_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemChuongTrinhKhuyenMai.ItemClick
        Me.ribbonControl.Minimized = True
        ChuongTrinhKhuyenMai.Show()
        ChuongTrinhKhuyenMai.MdiParent = Me
        ChuongTrinhKhuyenMai.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemSoChungTu_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemSoChungTu.ItemClick
        Me.ribbonControl.Minimized = True
        DMSoChungTu.Show()
        DMSoChungTu.MdiParent = Me
        DMSoChungTu.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemHoSoBenhNhan_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemHoSoBenhNhan.ItemClick
        Me.ribbonControl.Minimized = True
        HoSoBenhNhan.Show()
        HoSoBenhNhan.MdiParent = Me
        HoSoBenhNhan.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemHoSoSinhHieu_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemHoSoSinhHieu.ItemClick
        Me.ribbonControl.Minimized = True
        HoSoSinhHieu.Show()
        HoSoSinhHieu.MdiParent = Me
        HoSoSinhHieu.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemHoSoChuyenVien_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemHoSoChuyenVien.ItemClick
        Me.ribbonControl.Minimized = True
        HoSoChuyenVien.Show()
        HoSoChuyenVien.MdiParent = Me
        HoSoChuyenVien.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub BarButtonItemHoSoXetNghiem_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemHoSoXetNghiem.ItemClick
        Me.ribbonControl.Minimized = True
        HoSoXetNghiem.Show()
        HoSoXetNghiem.MdiParent = Me
        HoSoXetNghiem.WindowState = FormWindowState.Maximized
    End Sub
End Class
